#include <stdio.h>
#include <stdlib.h>

int main (int argc, char const* argv[])
{
    int m, n, i, k;
    double ans, j[1000], f[1000], rate[1000], t;

    while (scanf("%d %d", &m, &n) != EOF) {
        if (-1 == m && -1 == n) break;

        for (i = 0; i < n; i++) {
            scanf("%lf %lf", &j[i], &f[i]);
            rate[i] = j[i] / f[i];
        }

        for (i = 0; i < n-1; i++) {
            for (k = i+1; k < n; k++) {
                if (rate[i] < rate[k]) {
                    t = rate[i]; rate[i] = rate[k]; rate[k] = t;
                    t = j[i]; j[i] = j[k]; j[k] = t;
                    t = f[i]; f[i] = f[k]; f[k] = t;
                }
            }
        }

        ans = 0;
        for (i = 0; i < n; i++) {
            if (m > f[i]) {
                ans += j[i];
                m -= f[i];
            } else {
                ans += m * rate[i];
                break;
            }
        }

        printf("%.3lf\n", ans);
    }

    return 0;
}
